<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>安装 | sksPluginElErp</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="https://talk.gitee.com/search/resources/images/logo.svg?20200207">
    <meta name="description" content="Vue 驱动的静态网站生成器">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <meta name="keywords" content="Sks框架,JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github,markdown">
    <meta name="themeBak-color" content="#11a8cd">
    
    <link rel="preload" href="/assets/css/0.styles.9ea0c970.css" as="style"><link rel="preload" href="/assets/js/app.321f2bf8.js" as="script"><link rel="preload" href="/assets/js/2.a5e5ef97.js" as="script"><link rel="preload" href="/assets/js/8.f59d3119.js" as="script"><link rel="prefetch" href="/assets/js/10.89292fb0.js"><link rel="prefetch" href="/assets/js/11.1d8a964b.js"><link rel="prefetch" href="/assets/js/12.dd1b5a6e.js"><link rel="prefetch" href="/assets/js/13.c006e013.js"><link rel="prefetch" href="/assets/js/14.e09832a5.js"><link rel="prefetch" href="/assets/js/15.d10ea6e3.js"><link rel="prefetch" href="/assets/js/16.20e60327.js"><link rel="prefetch" href="/assets/js/17.56995e59.js"><link rel="prefetch" href="/assets/js/18.433fb3d1.js"><link rel="prefetch" href="/assets/js/3.11e09eaa.js"><link rel="prefetch" href="/assets/js/4.0499b603.js"><link rel="prefetch" href="/assets/js/5.e4a1c443.js"><link rel="prefetch" href="/assets/js/6.6bc77299.js"><link rel="prefetch" href="/assets/js/7.a3f63cd4.js"><link rel="prefetch" href="/assets/js/9.00518440.js">
    <link rel="stylesheet" href="/assets/css/0.styles.9ea0c970.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">sksPluginElErp</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/sksPluginElErp/10.介绍/01.translation.html" class="nav-link">
  elErp扩展
</a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/sksPluginElErp/10.介绍/01.translation.html" class="nav-link">
  elErp扩展
</a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>介绍</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/sksPluginElErp/10.介绍/01.translation.html" class="active sidebar-link">translation</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/sksPluginElErp/10.介绍/01.translation.html#npm安装" class="sidebar-link">npm安装</a></li><li class="sidebar-sub-header"><a href="/sksPluginElErp/10.介绍/01.translation.html#引入使用" class="sidebar-link">引入使用</a></li></ul></li><li><a href="/sksPluginElErp/10.介绍/90.常见错误.html" class="sidebar-link">常见错误</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>工具包方法</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/sksPluginElErp/20.工具包方法/01.常用.html" class="sidebar-link">常用</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>封装组件</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/sksPluginElErp/30.封装组件/10.Button按钮.html" class="sidebar-link">Button按钮</a></li><li><a href="/sksPluginElErp/30.封装组件/20.DateTime时间日期选择.html" class="sidebar-link">DateTime时间日期选择</a></li><li><a href="/sksPluginElErp/30.封装组件/80.SksSelectSingleByLookupController下拉选择单选.html" class="sidebar-link">SksSelectSingleByLookupController下拉选择单选</a></li><li><a href="/sksPluginElErp/30.封装组件/81.SksSelectMultipleByLookupService下拉选择多选.html" class="sidebar-link">SksSelectMultipleByLookupService下拉选择多选</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>页面处理</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/sksPluginElErp/40.页面处理/10.对话框.html" class="sidebar-link">对话框</a></li><li><a href="/sksPluginElErp/40.页面处理/20.主页列表.html" class="sidebar-link">主页列表</a></li><li><a href="/sksPluginElErp/40.页面处理/21.sksTable列表.html" class="sidebar-link">sksTable列表</a></li><li><a href="/sksPluginElErp/40.页面处理/30.SksTableQueryFormEl列表过滤.html" class="sidebar-link">SksTableQueryFormEl列表过滤</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="安装"><a href="#安装" class="header-anchor">#</a> 安装</h1> <h2 id="npm安装"><a href="#npm安装" class="header-anchor">#</a> npm安装</h2> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">npm</span> <span class="token function">install</span> sks-plugin-el-erp
</code></pre></div><h2 id="引入使用"><a href="#引入使用" class="header-anchor">#</a> 引入使用</h2> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">let</span> request<span class="token operator">=</span>axios<span class="token punctuation">.</span><span class="token function">create</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    <span class="token comment">// axios中请求配置有baseURL选项，表示请求URL公共部分</span>
    <span class="token comment">//baseURL: 'http://location:8080',</span>
    <span class="token literal-property property">baseURL</span><span class="token operator">:</span> process<span class="token punctuation">.</span>env<span class="token punctuation">.</span><span class="token constant">VUE_APP_BASE_API</span><span class="token punctuation">,</span>
    <span class="token comment">// 超时</span>
    <span class="token literal-property property">timeout</span><span class="token operator">:</span> <span class="token number">10000</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>

<span class="token keyword">import</span>  SksPluginElErp <span class="token keyword">from</span> <span class="token string">'sks-plugin-el-erp'</span>
Vue<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>SksPluginElErp<span class="token punctuation">,</span><span class="token punctuation">{</span>
    <span class="token literal-property property">request</span><span class="token operator">:</span> request<span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="webpack配置"><a href="#webpack配置" class="header-anchor">#</a> webpack配置</h3> <h4 id="vue-config-js文件中配置"><a href="#vue-config-js文件中配置" class="header-anchor">#</a> vue.config.js文件中配置</h4> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">configureWebpack</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token literal-property property">name</span><span class="token operator">:</span> name<span class="token punctuation">,</span>
        <span class="token literal-property property">resolve</span><span class="token operator">:</span> <span class="token punctuation">{</span>
            <span class="token literal-property property">alias</span><span class="token operator">:</span> <span class="token punctuation">{</span>
                <span class="token string-property property">'@'</span><span class="token operator">:</span> <span class="token function">resolve</span><span class="token punctuation">(</span><span class="token string">'src'</span><span class="token punctuation">)</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token literal-property property">plugins</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token comment">// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件</span>
            <span class="token keyword">new</span> <span class="token class-name">CompressionPlugin</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
                <span class="token literal-property property">cache</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>                   <span class="token comment">// 不启用文件缓存</span>
                <span class="token literal-property property">test</span><span class="token operator">:</span> <span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex">\.(js|css|html)?$</span><span class="token regex-delimiter">/</span><span class="token regex-flags">i</span></span><span class="token punctuation">,</span>     <span class="token comment">// 压缩文件格式</span>
                <span class="token literal-property property">filename</span><span class="token operator">:</span> <span class="token string">'[path].gz[query]'</span><span class="token punctuation">,</span>   <span class="token comment">// 压缩后的文件名</span>
                <span class="token literal-property property">algorithm</span><span class="token operator">:</span> <span class="token string">'gzip'</span><span class="token punctuation">,</span>              <span class="token comment">// 使用gzip压缩</span>
                <span class="token literal-property property">minRatio</span><span class="token operator">:</span> <span class="token number">0.8</span>                   <span class="token comment">// 压缩率小于1才会压缩</span>
            <span class="token punctuation">}</span><span class="token punctuation">)</span>
        <span class="token punctuation">]</span><span class="token punctuation">,</span>
        <span class="token literal-property property">module</span><span class="token operator">:</span> <span class="token punctuation">{</span>
            <span class="token literal-property property">rules</span><span class="token operator">:</span> <span class="token punctuation">[</span>
                <span class="token comment">//加上这段 start</span>
                <span class="token punctuation">{</span>
                    <span class="token literal-property property">test</span><span class="token operator">:</span> <span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex">\.js$</span><span class="token regex-delimiter">/</span></span><span class="token punctuation">,</span>    <span class="token comment">//打包规则应用到以css结尾的文件上</span>
                    <span class="token literal-property property">loader</span><span class="token operator">:</span> <span class="token string">'babel-loader'</span><span class="token punctuation">,</span>
                    <span class="token literal-property property">include</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token function">resolve</span><span class="token punctuation">(</span><span class="token string">'src'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token function">resolve</span><span class="token punctuation">(</span><span class="token string">'node_modules/sks-plugin-el-erp/lib'</span><span class="token punctuation">)</span><span class="token punctuation">]</span>
                <span class="token punctuation">}</span>
                <span class="token comment">//加上这段 end</span>
            <span class="token punctuation">]</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span>
</code></pre></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">最后更新时间:</span> <span class="time">2024/6/12 15:23:09</span></div></footer> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/sksPluginElErp/10.介绍/90.常见错误.html">
        常见错误
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/assets/js/app.321f2bf8.js" defer></script><script src="/assets/js/2.a5e5ef97.js" defer></script><script src="/assets/js/8.f59d3119.js" defer></script>
  </body>
</html>
